package cn.wolfcode.service.impl;

import cn.wolfcode.domain.Classinfo;
import cn.wolfcode.mapper.ClassMapper;
import cn.wolfcode.queryobject.ClassQueryObject;
import cn.wolfcode.queryobject.QueryObject;
import cn.wolfcode.service.IClassService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClassServiceImpl implements IClassService {
    @Autowired
    private ClassMapper classMapper;

    @Override
    public void insert(Classinfo classinfo) {
        classMapper.insert(classinfo);
    }

    @Override
    public void delete(Long id) {
        classMapper.delete(id);
    }

    @Override
    public void update(Classinfo classinfo) {
        classMapper.update(classinfo);
    }

    @Override
    public Classinfo selectOne(Long id) {
        return classMapper.selectOne(id);
    }

    @Override
    public List<Classinfo> selectAll() {
        return classMapper.selectAll();
    }

    @Override
    public PageInfo<Classinfo> query(ClassQueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<Classinfo> dataList = classMapper.queryForList(qo);
        return new PageInfo(dataList);
    }
}


